<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Upload photo</title>
</head>
<body>

<a href="./LogoutController">Log out</a> <br/>
<a href="./editUser.jsp">Edit personal information</a> <br/>
<a href="./HomeController">Home</a> <br/>

<form action="./UploadImageController" method="post" accept-charset="UTF-8"
		enctype="multipart/form-data">
	<table>
		<tr>
			<td><label for="title">Title</label></td>
			<td><input type="text" name="title"></td>
		</tr>
		<tr>
			<td><label for="description">Description</label></td>
			<td><textarea name="description"></textarea></td>
		</tr>
		<tr>
			<td><label for="public">Public</label></td>
			<td><input type="checkbox" name="public"></td>
		</tr>
		<tr>
			<td><label for="tags_allowed">Tags allowed</label></td>
			<td><input type="checkbox" name="tags_allowed"></td>
		</tr>
		<tr>
			<td><label for="notes_allowed">Notes allowed</label></td>
			<td><input type="checkbox" name="notes_allowed"></td>
		</tr>
		<tr>
			<td><label for="comments_allowed">Comments allowed</label></td>
			<td><input type="checkbox" name="comments_allowed"></td>
		</tr>
		<tr>
			<td><label for="albums">Select album</label></td>
			<td>
				<select name="albums">
					<c:if test="${ empty requestScope.userAlbums }">
						<option value="x">- NO ALBUMS -</option>
					</c:if>
					<c:if test="${ not empty requestScope.userAlbums }">
						<c:forEach var="currentAlbum" items="${ requestScope.userAlbums }">
							<option value="${ currentAlbum.id }">${ currentAlbum.title }</option>
						</c:forEach>
					</c:if>
				</select>
			</td>
		</tr>
		<tr>
			<td><label for="image">Images: </label></td>
			<td><input name="image" type="file" accept="image/jpeg,image/bmp,image/png" /></td>
		</tr>
		<tr>
			<c:if test="${ empty requestScope.userAlbums }">
				<td><input type="submit" value="Upload" disabled="disabled"></td>
			</c:if>
			<c:if test="${ not empty requestScope.userAlbums }">
				<td><input type="submit" value="Upload"></td>
			</c:if>
		</tr>
	</table>
</form>

</body>
</html>